/* uedb_param.h */
#ifndef UE_DB_PARAM_H
#define UE_DB_PARAM_H

#pragma pack(push, 1)

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

#define MAX_UEDB_PARAM_NAME_LEN         255
#define MAX_UEDB_PARAM_VALUE_LEN        2047

typedef struct _tag_uedb_param
{
	char   name[MAX_UEDB_PARAM_NAME_LEN + 1];            /* parameter name */
	char   value[MAX_UEDB_PARAM_VALUE_LEN + 1];          /* parameter value */
	struct _tag_uedb_param *next;                        /* pointer to the next parameter item */
}uedb_param;

/* Add a new item into a parameter list
 * @param[out] pparamlist A pointer to the parameter list
 * @param[in] param The new item to be added
 * @return UE_DB_ERR_SUCCESS indicate success, otherwise some error occur.
 */
int addparam(uedb_param **pparamlist, const char* param);

/* Clear the whole parameter list
 * @param[in/out] paramlist The parameter list to be clear. After clear, the parameter will be invalid and can't be used again.
 */
void clearparam(uedb_param *paramlist);

/* Get the value of a parameter from parameter list according to the specified parameter name.
 * @param[in] paramlist A pointer to the parameter list
 * @param[in] name Null-terminated string of the name of the parameter to search
 * @return NULL indicate does not find the specified parameter; Otherwise will return the value of the parameter.
 * If the specified parameter appear more than one time, the value will be the last occur.
 */
const char* getparam(const uedb_param *paramlist, const char* name);

/* Parse parameter list from the parameter string
 * @param[out] pparamlist A pointer to the parameter list
 * @param[in] params The parameter string to parse
 * @return UE_DB_ERR_SUCCESS indicate success, otherwise some error occur.
 */
int parseparams(uedb_param **pparamlist, const char* params);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#pragma pack(pop)


#endif /* UE_DB_PARAM_H */